﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using CoreEx.Common.Reflection;

namespace CoreEx.Common.Repository.Implementation
{
    public class RepositoryTypeDescriptor : ITypeDescriptor
    {

        private Type _targetType;

        public RepositoryTypeDescriptor(Type targetType)
        {
            _targetType = targetType;
        }

        public IEnumerable<MethodInfo> GetMethods()
        {
            var methods = _targetType.GetMethods().Except(_targetType.GetMethods().Where(m => m.Name == "LoadWith"));
            return methods;
        }

        public IEnumerable<Type> GetParameterTypes(MethodInfo methodInfo)
        {
            return null;
        }

        public Type GetReturnType(MethodInfo methodInfo)
        {
            return methodInfo.ReturnType;
        }
    }
}
